﻿@using EIP.Common.Entities
@{
    string action, controller;
    var area = action = controller = string.Empty;
    object areaName;
    ViewContext.RouteData.DataTokens.TryGetValue("area", out areaName);
    if (areaName != null)
    {
        area = areaName.ToString();//区域
        controller = ViewContext.RouteData.Values["controller"].ToString();//控制器
        action = ViewContext.RouteData.Values["action"].ToString();//方法
    }
    MvcRote mvcRote = new MvcRote()
    {
        Area = area,
        Controller = controller,
        Action = action
    };
    @Html.Hidden("area", mvcRote.Area)
    @Html.Hidden("aontroller", mvcRote.Controller)
    @Html.Hidden("action", mvcRote.Action)
   
    <script>
        $(function () {
            var toolbar = "";
            $.ajax({
                url: "/System/Permission/GetFunctionByMenuIdAndUserId", // 跳转到地址
                data: { Area: $("#area").val(), Controller: $("#aontroller").val(), Action: $("#action").val() },
                type: "post",
                async: true, //开启异步模式
                dataType: "json",
                success: function (data) {
                    $.each(data, function (i, item) {
                        toolbar += ' <a onclick="' + item.Script + '();return false;" title="' + item.Name + '" data-toggle="tooltip"  class="btn btn-default btn-sm" href="javascript:void(0)"><i class="' + item.Icon + '">' + item.Name + '</i></a>';
                    });

                    $("#partial_button_toolbar").html(toolbar);
                },
                error: function () {
                    DialogTipsMsgError(Language.common.ajaxposterror);
                }
            });
        });
    </script>
}